<template>
    <van-radio-group v-model="curValue"  style="width: 100%;display: flex;">
        <van-radio v-for="(item,index) in options" v-bind:key="index" :name="item.value" style="padding-right: 8px;">{{item.text}}</van-radio>
    </van-radio-group>
</template>

<script lang="ts">
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';

@Component({
    components: {
    }
})
export default class AppRadio extends Vue {


            
        /**
         * 代码表列表项
         *
         * @type {Array<any>}
         * @memberof AppRadio
         */
        @Prop() public options?:Array<any>;
        
        /**
         * 输入值
         *
         * @type {any}
         * @memberof AppRadio
         */
        @Prop() public value?: any;
        
        /**
         * 获取输入的Value值
         *
         * @memberof AppRadio
         */
		get curValue(){
			if(this.value){
                if(this.options && this.options.length >0 && typeof this.options[0].value  == "number" ){
                    return parseInt(this.value);
                }else{
                    return this.value;
                }
            }
		};

		/**
         * 根据curValue变化抛出事件valuechange
         *
         * @memberof AppRadio
         */
		set curValue(val:any){
			this.$emit('valuechange',val);
        }

		/**
         * 禁用
         *
         * @type {boolean}
         * @memberof AppRadio
         */
		@Prop() public disabled?: boolean;

 	}
</script>
<style lang="less">

</style>